package nf.util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class CloseHelpr {
    public static void CloseRPC( ResultSet R,PreparedStatement P, Connection C ){
        try {
            if(R!=null)R.close();
        } catch (SQLException e) {
            System.out.println("关闭ResultSet时发生异常：" + e.getMessage());
        }
        try {
            if (P != null) P.close();
        } catch (SQLException e) {
            System.out.println("关闭PreparedStatement时发生异常：" + e.getMessage());
        }
        try {
            if (C != null) C.close();
        } catch (SQLException e) {
            System.out.println("关闭Connection时发生异常：" + e.getMessage());
        }

    }
    public static void ClosePC(PreparedStatement P,Connection C){
        try {
            if (P != null) P.close();
        } catch (SQLException e) {
            System.out.println("关闭PreparedStatement时发生异常：" + e.getMessage());
        }
        try {
            if (C != null) C.close();
        } catch (SQLException e) {
            System.out.println("关闭Connection时发生异常：" + e.getMessage());
        }
    }
}
